Skip to content

Instantly share code, notes, and snippets.

@kvedala
kvedala / main.go
Created May 27, 2022 21:03
Generating JWT Tokens with random secret key in golang
package main
import (
"crypto/hmac"
"crypto/sha512"
"fmt"
"log"
"math/rand"
"time"
@rxwx
rxwx / pulseversion.py
Created August 13, 2019 09:04
Pulse Secure Version Scanner
import requests
import sys
import re
HEADERS = {"User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:67.0) Gecko/20100101 Firefox/67.0"}
if len(sys.argv) != 2:
print " Usage: python pulseversion.py <target ip/domain>"
sys.exit(1)
@sukima
sukima / .gitignore
Last active May 9, 2024 23:52
Failing testdouble TypeScript issue
/node_modules
test.js
@sukima
sukima / -private\.js
Last active May 9, 2024 23:51
XState Decorators
export const CURRENT_STATE = Symbol('current state');
export const STATE_PROPS = Symbol('state properties');
export const MACHINE = Symbol('machine');
export const LISTENERS = Symbol('listeners');
export const CONFIG = Symbol('config');
export const CONTEXT = Symbol('context');
@Sonata26
Sonata26 / valheim-console-guide.md
Last active May 9, 2024 23:50
Valheim Console Commands Guide Backup
@sukima
sukima / keyup_event.js
Created March 28, 2014 01:12
This is how I managed to facilitate keyboard events in multiple browsers
// <input id="my-input-element" type="text" value="foo"/>
var evt, node = document.getElementById('my-input-element');
// Have to use dispatchEvent/fireEvent because jQuery.trigger will not
// fire an event attached via addEventListener. Each environment has an
// unusual way to trigger a keyup event.
if (node.dispatchEvent) {
// Sane browsers
try {
// Chrome, Safari, Firefox
@sukima
sukima / ember-intl-lists.md
Created September 18, 2022 13:46
An enhanclement to handle internationalized lists in Ember.

Ember-intl uses the format.js library under the hood which uses the ICU Message Syntax. This syntax has many provisions for handling different types of interpolated data such as plural and select. But it lacks list formatting. Deep in the ICU Documentation it hints at the correct course of action:

Format the parameters separately (recommended)

You can format the parameter as you need before calling MessageFormat, and then passing the resulting string as a parameter to MessageFormat.

ICU Messages § Argument formatting

Luckily, JavaScript has a solution for this in the specs with [Intl.ListFormat](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Referenc

@sukima
sukima / XORCipher.js
Last active May 9, 2024 23:49
A Super simple encryption cipher using XOR and Base64 in JavaScript
// XORCipher - Super simple encryption using XOR and Base64
//
// Depends on [Underscore](http://underscorejs.org/).
//
// As a warning, this is **not** a secure encryption algorythm. It uses a very
// simplistic keystore and will be easy to crack.
//
// The Base64 algorythm is a modification of the one used in phpjs.org
// * http://phpjs.org/functions/base64_encode/
// * http://phpjs.org/functions/base64_decode/
@sukima
sukima / test.js
Last active May 9, 2024 23:49 — forked from robneville73/test.js
firstReport: computed.alias('reports.firstObject'),
someOtherThing: computed('reports.[]', function() {
return get(this, 'reports').map(report => doCoolStuff(report));
}),
...
...
...
getReports: task(function*() {
@poteto
poteto / bookmarklet.js
Last active May 9, 2024 23:48
Converts a HTML table with `thead` and `tbody` into an array of objects. You can then use JSON.stringify(json) or copy(json) to your clipboard.
javascript:void%20function(){(function(t){t.extend(t.fn,{tableToJSON:function(){var%20n=this,r=t(%22thead%20th%22,n).map(function(n,r){return%20t(r).text().trim().toLowerCase()});return%20t(%22tbody%20tr%22,n).map(function(n,e){var%20o=t(e),a={};return%20t(%22td%22,o).each(function(n,e){var%20o=r[n];a[o]=t(e).text().trim()}),a}).toArray()}})})(jQuery)}();